using System;
using System.Collections.Generic;
using System.Text;

namespace DocLibApp
{
    public class def
    {
        //constant
        public static string ZipPassword = "hmhhml"; //default password for zipping unzipping zip file

        //default user name & password for power user
        public static string PowerUserName = "admin";
        public static string PowerUserPassword = "abc123";

        //security string key to mask / unmask text, use in util.MaskString & util.UnMaskString
        public static string mask_sec_key = "cNDj5]YO$E4Se%iIobFV*k3+*b9Gd6";
        //security string key used for salt (50 characters)
        public static string salt_string = "4O5q62FZNRRVcdPvcxia3xHw0AtJJSdEAFfg9xFbLVNE8OEgLT";
        //key used for salt 2nd (50 characters, including special characters)
        public static string salt_string_two = "dak4F6Pw7TcaR0H97hStSKEuFZP3vCfkZXBJVrjvCCgI6O0FY4";
        //key used for generate audit trail hash
        public static string key_audit_trail = "xVZAZnKQvmTHG4Xa4n7icdf4DBkpgbSZ3SeLIgQPnMTLwoOU51";
        //default configuration filename
        public static string FileName_DefaultConfig = @"appconfig.xml";
        //default filename for license info
        public static string FileName_DefaultLicense = @"license.inf";

        //** Configuration key names **//
        public static string ck_DatabaseFileName_SQLite = "SQLiteDatabaseFileName";
        public static string ck_DatabaseFileName_Access = "AccessDatabaseFileName";
        public static string ck_Document_File_Path = "doc_file_path";

        public static string ck_Background_Image_Path = "background_image_path";
        public static string ck_Background_Image_Filename_Previous = "background_image_previous";

        //List & Options
        /*** recently used documents ***/
        public static int RecentDocumentList_Limit = 10; //storing only 10 most recently used document in the list
        public static string RecentDocumentList_Group = "RecentDoc";
        /*** save sql queries ***/
        public static int SaveQueryList_Limit = 20; // storing only 20 SaveSQL_Limit
        public static string SaveQueryList_Group = "SavedSQL";
        

        //pattern
        public static string Pattern_AuditTrailHash = "%DOC_ID%@%DT_EVENT%@%ACTION%@%SIGN_USER%";

        //Application
        //LICENSE
        //when click "purchase license" button on registration form, launch this web site link
        public static string URL_Purchase = "http://www.monkeycancode.com";

        //Application Code Group
        public static string CG_App_Code = "APP_CODE";

        //SQLite Table Name
        public static string tb_doc = "DOC_MAIN";
		public static string tb_doc_sql_create =    "CREATE TABLE [" + tb_doc +"](" +
                                                    "[DOC_ID] TEXT  UNIQUE NOT NULL PRIMARY KEY," +
                                                    "[TITLE] TEXT  NULL," +
                                                    "[AUTHOR] TEXT  NULL," +
                                                    "[CATEGORY] TEXT  NULL," +
                                                    "[TYPE] TEXT  NULL," +
                                                    "[IMPORTANCE] TEXT  NULL," +
                                                    "[KEYWORDS] TEXT  NULL," +
                                                    "[NOTE] TEXT  NULL," +
                                                    "[DT_CREATE] DATE  NULL," +
                                                    "[DT_UPDATE] DATE  NULL, " +
                                                    "[OWNER] TEXT  NULL, " +
                                                    "[ORIGINAL_FILENAME] TEXT  NULL," +
                                                    "[NUM_PAGES] INTEGER  NULL," +
                                                    "[LOCATION] TEXT  NULL," +
                                                    "[DT_DOC] DATE  NULL" +
                                                    ");";
        public static string tb_user = "DOC_USER";
        public static string tb_user_sql_create =   "CREATE TABLE [" + tb_user +"] ("+
                                                    "[USERNAME] TEXT  UNIQUE NOT NULL PRIMARY KEY,"+
                                                    "[PASSWORD] TEXT  NULL,"+
                                                    "[FIRSTNAME] TEXT  NULL,"+
                                                    "[LASTNAME] TEXT  NULL,"+
                                                    "[MIDDLENAME] TEXT  NULL, "+
                                                    "[ROLE_ID] TEXT  NULL " +
                                                    ");";

        public static string tb_doc_audit = "DOC_AUDIT";
        public static string tb_doc_audit_sql_create = "CREATE TABLE [" + tb_doc_audit + "] (" +
                                                    "[DOC_ID] TEXT  NOT NULL," +
                                                    "[EVENT_ID] INTEGER  PRIMARY KEY AUTOINCREMENT NOT NULL,"+
                                                    "[DT_EVENT] DATE  NOT NULL,"+
                                                    "[ACTION] TEXT  NOT NULL,"+
                                                    "[HASH] TEXT  NULL,"+
                                                    "[SIGN_USER] TEXT  NOT NULL"+
                                                    ")";
        public static string tb_doc_tag = "DOC_TAG";
        public static string tb_doc_tag_sql_create = "CREATE TABLE [" + tb_doc_tag + "] (" + 
                                                    "[DOC_ID] INTEGER  NOT NULL,"+
                                                    "[TAG_ID] INTEGER  NOT NULL,"+
                                                    "[DTID] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT"+
                                                    ")";
        //System tables
        public static string tb_table_columns = "SYSTEM_TABLE_FIELDS";
        public static string tb_table_columns_sql_create = "CREATE TABLE [" + tb_table_columns + "] (" +
                                                    "[TABLENAME] TEXT  NOT NULL,"+
                                                    "[FIELDNAME] TEXT  NOT NULL,"+
                                                    "[DESCRIPTION] TEXT  NULL,"+
                                                    "PRIMARY KEY ([TABLENAME],[FIELDNAME])" +
                                                    ")";
        public static string tb_list = "SYSTEM_LIST";
        public static string tb_list_sql_create = "CREATE TABLE [SYSTEM_LIST] (" +
                                                    "[NAME] TEXT  NOT NULL,"+
                                                    "[DESC] TEXT  NULL,"+
                                                    "[LIST_GROUP] TEXT  NULL,"+
                                                    "[DT_CREATE] DATE  NULL"+
                                                    ")";
        public static string tb_System_Code = "SYSTEM_CODE";
        public static string tb_System_Code_sql_create = "CREATE TABLE [" + tb_System_Code + "] (" +
                                                    "[ID] INTEGER  PRIMARY KEY AUTOINCREMENT NOT NULL,"+
                                                    "[CODE] TEXT  NOT NULL,"+
                                                    "[DESC] TEXT  NULL,"+
                                                    "[CODE_GROUP] TEXT  NULL,"+
                                                    "[NOTE] TEXT  NULL"+
                                                    ")";
        public static string tb_System_Log = "SYSTEM_LOG";
        public static string tb_System_Log_sql_create = "CREATE TABLE [" + tb_System_Log + "] (" +
                                                    "[EVENT_ID] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,"+
                                                    "[MESSAGE] TEXT  NOT NULL,"+
                                                    "[DT_EVENT] TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,"+
                                                    "[TYPE] TEXT  NOT NULL"+
                                                    ")";
        public static string tb_System_Tag = "SYSTEM_TAG";
        public static string tb_System_Tag_sql_create = "CREATE TABLE [" + tb_System_Tag +"] (" +
                                                    "[TAG_ID] INTEGER  NOT NULL PRIMARY KEY,"+
                                                    "[TAG_NAME] TEXT  NOT NULL,"+
                                                    "[PARENT_ID] INTEGER  NULL,"+
                                                    "[NOTE] TEXT  NULL"+
                                                    ")";
        //Template table name
        public static string tb_template_header = "DOC_TEMPLATE";
        public static string tb_template_header_sql_create = "CREATE TABLE [" + tb_template_header + "] (" + 
                                                    "[TEMPLATE_ID] TEXT  UNIQUE NOT NULL PRIMARY KEY,"+
                                                    "[DESCRIPTION] TEXT  NULL,"+
                                                    "[DT_CREATE] DATE  NOT NULL,"+
                                                    "[DT_UPDATE] DATE  NOT NULL,"+
                                                    "[AUTHOR] TEXT  NULL"+
                                                    ")";
        public static string tb_template_field = "DOC_TEMPLATE_FIELD";
        public static string tb_template_field_sql_create = "CREATE TABLE [" + tb_template_field + "] (" +
                                                    "[TEMPLATE_ID] TEXT  NOT NULL," +
                                                    "[FIELD_NAME] TEXT  NOT NULL,"+
                                                    "[DEFAULT_VALUE] TEXT  NULL,"+
                                                    "[ORDER_NO] INTEGER  NOT NULL"+
                                                    ")";
        //security role
        public static string tb_sec_role_header = "SEC_ROLE_HEADER";
        public static string tb_sec_role_header_sql_create = "CREATE TABLE [" +tb_sec_role_header + "] ("+
                                                    "[ROLE_ID] TEXT  UNIQUE NULL," +
                                                    "[DESCRIPTION] TEXT  NULL,"+
                                                    "[DT_CREATE] DATE DEFAULT CURRENT_TIMESTAMP NULL,"+
                                                    "[DT_UPDATE] DATE DEFAULT CURRENT_TIMESTAMP NULL" +
                                                    ")";
        public static string tb_sec_role_entry = "SEC_ROLE_ENTRY";
        public static string tb_sec_role_entry_sql_create = "CREATE TABLE [" + tb_sec_role_entry+ "] (" +
                                                    "[ROLE_ID] TEXT  NOT NULL,"+
                                                    "[PROCEDURE] TEXT  NOT NULL"+
                                                    ")";
        public static string tb_sec_role_assignment = "SEC_ROLE_ASSIGNMENT";
        public static string tb_sec_role_assignment_sql_create = "CREATE TABLE [" + tb_sec_role_assignment +"] (" +
                                                    "[USER] TEXT  NOT NULL," +
                                                    "[ROLE_ID] TEXT  NOT NULL" +
                                                    ")";

        //query name
        //SQLite Query
        public static string qry_stat_list = "SELECT CODE, DESC, CODE_GROUP FROM " +
            "SYSTEM_CODE WHERE [CODE_GROUP] In " +
            "('DOC_CATEGORY','DOC_TYPE','DOC_OWNER','DOC_IMPORTANCE','DOC_LOCATION') ORDER BY [CODE_GROUP], [CODE]";
        
    }
}
